Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pumpify

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pumpify

Combine an array of streams into a single duplex stream using pump and duplexify

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11M
increased by0.33%
Maintainers
1
Weekly downloads
 
Created

What is pumpify?

The pumpify npm package is a module that combines an array of streams into a single duplex stream using pump and duplexify. It handles the piping between streams for you, and destroys all streams if one of them closes. This is particularly useful when you want to work with multiple streams in a sequential manner, ensuring that data is properly piped through each stage and that resources are cleaned up if an error occurs.

What are pumpify's main functionalities?

Combining streams into a single duplex stream

This code sample demonstrates how to create a single duplex stream that reads from a file, compresses the data using gzip, and then writes the compressed data to a new file. The pumpify module handles the piping and stream destruction.

const pumpify = require('pumpify');
const fs = require('fs');
const zlib = require('zlib');
const stream = pumpify(fs.createReadStream('input.txt'), zlib.createGzip(), fs.createWriteStream('output.txt.gz'));

Error handling across piped streams

This code sample shows how to handle errors in a pipeline created with pumpify. If any of the streams in the pipeline emit an error, pumpify will destroy all streams and emit the error on the resulting duplex stream.

const pumpify = require('pumpify');
const fs = require('fs');
const zlib = require('zlib');
const stream = pumpify(fs.createReadStream('input.txt'), zlib.createGzip(), fs.createWriteStream('output.txt.gz'));
stream.on('error', err => console.error('Stream error:', err));

Other packages similar to pumpify

Keywords

FAQs

Package last updated on 01 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc